<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>四叶玫瑰</title>
</head>
<body>
    <script>
        /* 求出1000-9999之间的四叶玫瑰数 */

        for(var num = 1000;num <= 9999; num++){
            // 拆分个、十、百、千

            //千：除千取整
            var t = parseInt(num/1000);
            //百：除千取余，除百取整
            var h = parseInt((num%1000)/100);
            //十：除千取余，除百取余，除十取整
            var d = parseInt(((num%1000)%100)/10);
            //个：除千取余，除百取余，除十取余
            var b = ((num%1000)%100)%10;

            if(t*t*t*t + h*h*h*h + d*d*d*d + b*b*b*b === num){
                document.write(num+'&nbsp&nbsp');
            }
            num++;
        }



    </script>
</body>
</html>